#!/bin/bash

SERVER=yaoba.xayoudao.com
SERVER_PATH=yunkelai
PWD=`pwd`
echo $PWD$SERVER_PATH

rm -rf server.tar.gz
echo release package

if [ "$1"s = "small"s ]; then
	tar zcvf server.tar.gz --exclude='images/' --exclude='uploads/' --exclude='.git'  --exclude='docs'  --exclude='server.tar.gz' --exclude='s' --exclude='*.db' --exclude='protected/apples-group.json' --exclude='._.gitignore' --exclude='.gitignore' --exclude='assets/' --exclude='protected/runtime/' .
else
	tar zcvf server.tar.gz --exclude='uploads/' --exclude='.git'  --exclude='docs'  --exclude='server.tar.gz' --exclude='s' --exclude='*.db' --exclude='protected/apples-group.json' --exclude='._.gitignore' --exclude='.gitignore' --exclude='assets/' --exclude='protected/runtime/' .
fi

echo package success , start upload!

scp server.tar.gz root@$SERVER:/alidata/www/$SERVER_PATH/
ssh root@$SERVER /alidata/www/$SERVER_PATH/deploy.sh
rm -rf server.tar.gz
echo main server success!!

echo success!
say success! &
